package com.ruoyi.web.controller.galaxy;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.galaxy.service.IGalaxyTradeService;
import com.ruoyi.galaxy.vo.GalaxyApiPalaceOrderRequest;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author yeoman
 * @date 2025/4/10 16:15
 * @description 银河票务交易
 */
@Controller
@RequestMapping("/galaxy/trade")
public class GalaxyTradeController extends BaseController {

    private final String prefix = "galaxy/trade";

    @Resource
    private IGalaxyTradeService galaxyTradeService;

    /**
     * 下单
     */
    @Log(title = "银河票务下单", businessType = BusinessType.UPDATE)
    @RequiresPermissions("galaxy:order:placeOrder")
    @PostMapping("/placeOrder")
    @ResponseBody
    public AjaxResult placeOrder(@Validated GalaxyApiPalaceOrderRequest request) {
        return toAjax(galaxyTradeService.placeOrder(request));
    }

}
